<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>libcoap: URI Parsing Functions</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">libcoap<span id="projectnumber">&#160;4.2.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.8 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('group__uri__parse.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle"><div class="title">URI Parsing Functions</div></div>
</div><!--header-->
<div class="contents">

<p>CoAP PDUs contain normalized URIs with their path and query split into multiple segments.  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga9b19917fbf64f3a35a52d31ae5f6f76c" id="r_ga9b19917fbf64f3a35a52d31ae5f6f76c"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__uri__parse.html#ga9b19917fbf64f3a35a52d31ae5f6f76c">coap_split_uri</a> (const <a class="el" href="uthash_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *str_var, size_t len, <a class="el" href="structcoap__uri__t.html">coap_uri_t</a> *uri)</td></tr>
<tr class="memdesc:ga9b19917fbf64f3a35a52d31ae5f6f76c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Parses a given string into URI components.  <br /></td></tr>
<tr class="separator:ga9b19917fbf64f3a35a52d31ae5f6f76c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga4a01c4a81338c39d0a2fb1e3859a6fb0" id="r_ga4a01c4a81338c39d0a2fb1e3859a6fb0"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__uri__parse.html#ga4a01c4a81338c39d0a2fb1e3859a6fb0">coap_split_path</a> (const <a class="el" href="uthash_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *s, size_t length, unsigned char *buf, size_t *buflen)</td></tr>
<tr class="memdesc:ga4a01c4a81338c39d0a2fb1e3859a6fb0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Splits the given URI path into segments.  <br /></td></tr>
<tr class="separator:ga4a01c4a81338c39d0a2fb1e3859a6fb0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga522cc4dfe723c2a3537f35ee2389ef74" id="r_ga522cc4dfe723c2a3537f35ee2389ef74"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__uri__parse.html#ga522cc4dfe723c2a3537f35ee2389ef74">coap_split_query</a> (const <a class="el" href="uthash_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *s, size_t length, unsigned char *buf, size_t *buflen)</td></tr>
<tr class="memdesc:ga522cc4dfe723c2a3537f35ee2389ef74"><td class="mdescLeft">&#160;</td><td class="mdescRight">Splits the given URI query into segments.  <br /></td></tr>
<tr class="separator:ga522cc4dfe723c2a3537f35ee2389ef74"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa152f147a0e2370b196deb5b364313df" id="r_gaa152f147a0e2370b196deb5b364313df"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcoap__string__t.html">coap_string_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__uri__parse.html#gaa152f147a0e2370b196deb5b364313df">coap_get_query</a> (const struct <a class="el" href="structcoap__pdu__t.html">coap_pdu_t</a> *request)</td></tr>
<tr class="memdesc:gaa152f147a0e2370b196deb5b364313df"><td class="mdescLeft">&#160;</td><td class="mdescRight">Extract query string from request PDU according to escape rules in 6.5.8.  <br /></td></tr>
<tr class="separator:gaa152f147a0e2370b196deb5b364313df"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gafcfd572c6550468200822c74e0d03929" id="r_gafcfd572c6550468200822c74e0d03929"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcoap__string__t.html">coap_string_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__uri__parse.html#gafcfd572c6550468200822c74e0d03929">coap_get_uri_path</a> (const struct <a class="el" href="structcoap__pdu__t.html">coap_pdu_t</a> *request)</td></tr>
<tr class="memdesc:gafcfd572c6550468200822c74e0d03929"><td class="mdescLeft">&#160;</td><td class="mdescRight">Extract uri_path string from request PDU.  <br /></td></tr>
<tr class="separator:gafcfd572c6550468200822c74e0d03929"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>CoAP PDUs contain normalized URIs with their path and query split into multiple segments. </p>
<p>The functions in this module help splitting strings. </p>
<h2 class="groupheader">Function Documentation</h2>
<a id="gaa152f147a0e2370b196deb5b364313df" name="gaa152f147a0e2370b196deb5b364313df"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaa152f147a0e2370b196deb5b364313df">&#9670;&#160;</a></span>coap_get_query()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structcoap__string__t.html">coap_string_t</a> * coap_get_query </td>
          <td>(</td>
          <td class="paramtype">const struct <a class="el" href="structcoap__pdu__t.html">coap_pdu_t</a> *&#160;</td>
          <td class="paramname"><em>request</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Extract query string from request PDU according to escape rules in 6.5.8. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">request</td><td>Request PDU. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Reconstructed and escaped query string part. </dd></dl>

</div>
</div>
<a id="gafcfd572c6550468200822c74e0d03929" name="gafcfd572c6550468200822c74e0d03929"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gafcfd572c6550468200822c74e0d03929">&#9670;&#160;</a></span>coap_get_uri_path()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structcoap__string__t.html">coap_string_t</a> * coap_get_uri_path </td>
          <td>(</td>
          <td class="paramtype">const struct <a class="el" href="structcoap__pdu__t.html">coap_pdu_t</a> *&#160;</td>
          <td class="paramname"><em>request</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Extract uri_path string from request PDU. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">request</td><td>Request PDU. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Reconstructed and escaped uri path string part. </dd></dl>

</div>
</div>
<a id="ga4a01c4a81338c39d0a2fb1e3859a6fb0" name="ga4a01c4a81338c39d0a2fb1e3859a6fb0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga4a01c4a81338c39d0a2fb1e3859a6fb0">&#9670;&#160;</a></span>coap_split_path()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int coap_split_path </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="uthash_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *&#160;</td>
          <td class="paramname"><em>s</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>length</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned char *&#160;</td>
          <td class="paramname"><em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t *&#160;</td>
          <td class="paramname"><em>buflen</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Splits the given URI path into segments. </p>
<p>Each segment is preceded by an option pseudo-header with delta-value 0 and the actual length of the respective segment after percent-decoding.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">s</td><td>The path string to split. </td></tr>
    <tr><td class="paramname">length</td><td>The actual length of <code>s</code>. </td></tr>
    <tr><td class="paramname">buf</td><td>Result buffer for parsed segments. </td></tr>
    <tr><td class="paramname">buflen</td><td>Maximum length of <code>buf</code>. Will be set to the actual number of bytes written into buf on success.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The number of segments created or <code>-1</code> on error. </dd></dl>

<p class="definition">Definition at line <a class="el" href="uri_8c_source.html#l00400">400</a> of file <a class="el" href="uri_8c_source.html">uri.c</a>.</p>

</div>
</div>
<a id="ga522cc4dfe723c2a3537f35ee2389ef74" name="ga522cc4dfe723c2a3537f35ee2389ef74"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga522cc4dfe723c2a3537f35ee2389ef74">&#9670;&#160;</a></span>coap_split_query()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int coap_split_query </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="uthash_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *&#160;</td>
          <td class="paramname"><em>s</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>length</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned char *&#160;</td>
          <td class="paramname"><em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t *&#160;</td>
          <td class="paramname"><em>buflen</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Splits the given URI query into segments. </p>
<p>Each segment is preceded by an option pseudo-header with delta-value 0 and the actual length of the respective query term.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">s</td><td>The query string to split. </td></tr>
    <tr><td class="paramname">length</td><td>The actual length of <code>s</code>. </td></tr>
    <tr><td class="paramname">buf</td><td>Result buffer for parsed segments. </td></tr>
    <tr><td class="paramname">buflen</td><td>Maximum length of <code>buf</code>. Will be set to the actual number of bytes written into buf on success.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The number of segments created or <code>-1</code> on error.</dd></dl>
<dl class="bug"><dt><b><a class="el" href="bug.html#_bug000002">Bug:</a></b></dt><dd>This function does not reserve additional space for delta &gt; 12. </dd></dl>

<p class="definition">Definition at line <a class="el" href="uri_8c_source.html#l00412">412</a> of file <a class="el" href="uri_8c_source.html">uri.c</a>.</p>

</div>
</div>
<a id="ga9b19917fbf64f3a35a52d31ae5f6f76c" name="ga9b19917fbf64f3a35a52d31ae5f6f76c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga9b19917fbf64f3a35a52d31ae5f6f76c">&#9670;&#160;</a></span>coap_split_uri()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int coap_split_uri </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="uthash_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *&#160;</td>
          <td class="paramname"><em>str_var</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>len</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcoap__uri__t.html">coap_uri_t</a> *&#160;</td>
          <td class="paramname"><em>uri</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Parses a given string into URI components. </p>
<p>The identified syntactic components are stored in the result parameter <code>uri</code>. Optional URI components that are not specified will be set to { 0, 0 }, except for the port which is set to <code>COAP_DEFAULT_PORT</code>. This function returns <code>0</code> if parsing succeeded, a value less than zero otherwise.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">str_var</td><td>The string to split up. </td></tr>
    <tr><td class="paramname">len</td><td>The actual length of <code>str_var</code> </td></tr>
    <tr><td class="paramname">uri</td><td>The <a class="el" href="structcoap__uri__t.html" title="Representation of parsed URI.">coap_uri_t</a> object to store the result. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><code>0</code> on success, or &lt; 0 on error. </dd></dl>

<p class="definition">Definition at line <a class="el" href="uri_8c_source.html#l00053">53</a> of file <a class="el" href="uri_8c_source.html">uri.c</a>.</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated on Fri Dec 27 2024 09:57:44 for libcoap by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.8 </li>
  </ul>
</div>
</body>
</html>
